﻿/***************************************************************************
 创建者: 华磊
 开始时间: 2019.9.20
 copyright: (C) 华友高科
 修改说明: (每次有修改就添加一条，带有 修改人，修改时间，修改描述)
 example (1) 姓名 2019.9.20 类的具体实现代码编写

 ***************************************************************************
 *  @file x.h
 *  功能:
 *
 *
 ***************************************************************************/
#ifndef MAINWINDOWFLEET_H
#define MAINWINDOWFLEET_H

#include <QMainWindow>
#include "commonhead.h"

#include "dockusermanage.h"
#include "dockagvmanage.h"
#include "dockuserlog.h"
#include "dockdevice.h"
#include "docktask.h"

class MapEditWindow;
class MonitorDockView;
class MonitorDockMapTree;
class MonitorDockProperty;
class MonitorDockBlock;
class MainWindowFleetTest;
class MainWindowTestManage;
class CommunicateNormalDelegate;
class GlobalData;

class MainWindowFleet : public QMainWindow
{
    Q_OBJECT
public:
    explicit MainWindowFleet(CommunicateNormalDelegate *communicateNormalIn,
                             GlobalData *globalDataIn,QWidget *parent = nullptr);
    void init();
signals:
    void sig_setSelectSelect();
    void sig_setSelectHand();
    void sig_repaint();
    void loginControllerSucess_signal();
//    void controllerLoginSignal(QVector<int> controllerIpAddress,QVector<int> hmiIpAddress,QString port,QString passwardString,int selectedAccount);

public slots:
    void loginControllerSucess_slot();
//    void controllerLogin_slot(QVector<int> controllerIpAddress,QVector<int> hmiIpAddress,
//                              QString port,QString passwardString,int selectedAccount);
    void updateMapShow_slot();
    void about();
    void aboutHY();

    void onServerConnect();
    void onServerDisconnect();
    void onServerConnectting();

    void onSendFail();
    void onWaitResponseTimeOut();
    void onTip(QString s);
    void onErr(int errcode,QString info);
    void onNewRequest();
    void updateCurrentUserInfo();

    void onMapEdit(bool b);
    void on_fleetTest_triggered(bool b);
    void on_laodMapFile_triggered();

    void onMapLoad();

    void on_selectSelect_triggered(bool b);
    void on_selectHandNew_triggered(bool b);
    void on_displayItemRatioIncrease_triggered(bool b);
    void on_displayItemRatioDecrease_triggered(bool b);
private:

    void createActions();
    void createStatusBar();
    //状态栏改变
    void statusbar_info(QString msg);
    void statusbar_err(QString msg);

    DockUserManage *dock_user_manage;
    DockAgvManage *dock_agv_manage;
    DockUserLog *dock_user_log;
    DockDevice *dock_device_log;
    DockTask *dock_task;

    QLabel *usernamelabel;
    QLabel *userrolelabel;
    QLabel *info_label;
    QLabel *error_label;
    QStatusBar *statusbar;

    QAction *action_map_edit;
    QAction *action_fleet_test;
    QAction *action_loadMapFile;

    MapEditWindow *editWindow;
//    MainWindowFleetTest *fleetTestWindow;
    MainWindowTestManage *fleetTestManagementWindow;


    //TODO 新增加
    OneMap *oneMap;
    MonitorDockMapTree *dockMapTree;
    MonitorDockProperty *dockProperty;
    MonitorDockView *dockView;
    MonitorDockBlock *blockView;
    QAction *selectSelect;
    QAction *selectHandNew;
    QAction *selectDisplayItemRatioIncrease;
    QAction *selectDisplayItemRatioDecrease;

    CommunicateNormalDelegate *communicateNormal;
    GlobalData *globalData;
};

#endif // MAINWINDOW_H
